import 'package:flutter/material.dart';
import 'package:xindong/common/xindong_common_vm.dart';
import 'package:xindong/models/user/xindong_home_user.dart';
import 'package:xindong/routes/tab_home/view/xindong_user_list_cell.dart';
import 'package:xindong/widgets/container/xindong_empty_container.dart';
import 'package:xindong/widgets/container/xindong_getx_builder_container.dart';

class XinDongVisitListView extends StatelessWidget {
  final XinDongCommonVM viewClass;
  final String emptyTips;

  const XinDongVisitListView({Key? key, required this.viewClass, required this.emptyTips}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return XinDongRefreshContainer(
      viewClass: viewClass,
      child: XinDongEmptyContainer(
        dataList: viewClass.dataList,
        emptyTips: emptyTips,
        child: ListView.separated(
          itemCount: viewClass.dataList?.length ?? 0,
          itemBuilder: (context, int index) {
            XinDongHomeUser model = viewClass.dataList![index];
            return XinDongUserListCell(model: model);
          },
          separatorBuilder: (BuildContext context, int index) {
            return const SizedBox(height: 1);
          },
        ),
      ),
    );
  }
}
